(function () {
  var ua = navigator.userAgent.toLowerCase();
  if (/^(icbc.com.cn|www.icbc.com.cn|www.95588.com|iepaweb|www1-jd)/.test(location.host)) {
    
    if (typeof headPageFilterFlag === "undefined") {
      var headPageFilterFlag = "0";
    }

    // in frame
    var inFrame = false;
    if (window.self !== window.top) {
      inFrame = true;
    }
    
    if (
      ua.indexOf("compatible") > -1
      && ua.indexOf("msie") > -1 
      && ua.indexOf("computerid") === -1 
      && headPageFilterFlag === "0"
      ) {
      if (!inFrame) {
        window.location.href = "/guide/upgrade.html";
      }
    }
    
    if (
      isMobile()
      && location.hash!=="#m"
      && (/^\/(icbc)?(\/)?$/i.test(location.pathname) || /\/icbc\/default\.htm/i.test(location.pathname))
      ) {
      window.location.href ="//m.icbc.com.cn";
    }

    function isMobile() {
      return /(iphone|ipod|ipad|android|mobile|blackberry|iemobile|mqqbrowser|fennec|wosbrowser|browserng|webos|symbian|windows phone|windows ce|ucweb)/.test(ua);
    }

  }
})();
